<?php

/**
 * TaskLocation filter form base class.
 *
 * @package    lbreminder
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseTaskLocationFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'latitude'      => new sfWidgetFormFilterInput(),
      'longitude'     => new sfWidgetFormFilterInput(),
      'street_number' => new sfWidgetFormFilterInput(),
      'street_name'   => new sfWidgetFormFilterInput(),
      'suburb'        => new sfWidgetFormFilterInput(),
      'postcode'      => new sfWidgetFormFilterInput(),
      'state'         => new sfWidgetFormFilterInput(),
      'country'       => new sfWidgetFormFilterInput(),
      'landmark_id'   => new sfWidgetFormPropelChoice(array('model' => 'Landmark', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'latitude'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'longitude'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'street_number' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'street_name'   => new sfValidatorPass(array('required' => false)),
      'suburb'        => new sfValidatorPass(array('required' => false)),
      'postcode'      => new sfValidatorPass(array('required' => false)),
      'state'         => new sfValidatorPass(array('required' => false)),
      'country'       => new sfValidatorPass(array('required' => false)),
      'landmark_id'   => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Landmark', 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('task_location_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'TaskLocation';
  }

  public function getFields()
  {
    return array(
      'id'            => 'Number',
      'latitude'      => 'Number',
      'longitude'     => 'Number',
      'street_number' => 'Number',
      'street_name'   => 'Text',
      'suburb'        => 'Text',
      'postcode'      => 'Text',
      'state'         => 'Text',
      'country'       => 'Text',
      'landmark_id'   => 'ForeignKey',
    );
  }
}
